#ifndef DATABASESEARCHDIALOG_H
#define DATABASESEARCHDIALOG_H

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLineEdit>
#include <QDialog>
#include <QString>
#include <QLabel>

#include "StockTableView.h"
#include "DataBase.h"
#include "Debug.h"

class DatabaseSearchDialog : public QDialog
{
    Q_OBJECT
private:
    StockTableView *Table;

    QLabel *SearchLabel;
    QLineEdit *SearchEdit;

    QPushButton *SelectButton;
    QPushButton *CancelButton;

    QHBoxLayout *SearchEditArea;
    QHBoxLayout *Buttons;
    QHBoxLayout *EditAndButtons;
    QVBoxLayout *MainLayout;

    int SearchField;

    void closeEvent ( QCloseEvent * event );
    void clear();

signals:
    void Item( const ItemType &item );

public slots:
    void NoItemIsSelected();

public:
    DatabaseSearchDialog(DataBase *db, int SearchField = -1, QWidget *parent = 0);
    ~DatabaseSearchDialog();
};

#endif // DATABASESEARCHDIALOG_H
